import { request } from '@/network/index'

// 获取所有权限列表
export function getRightsData(config) {
  return request(
    {
      url: `rights/${config}`,
      method: 'get'
    }
  )
}

export function getRolesData() {
  return request(
    {
      url: 'roles',
      method: 'get'
    }
  )
}
// 通过id删除权限
export function deleteRightsById(roleId, rids) {
  return request(
    {
      url: `roles/${roleId}/rights/${rids}`,
      method: 'delete'
    }
  )
}

// 角色授权
export function roleAuthorization(roleId, rids) {
  return request(
    {
      url: `roles/${roleId}/rights`,
      method: 'post',
      data: {
        rids: rids
      }
    }
  )
}
